<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>准备界面</title>
<script src="${pageContext.request.contextPath}/static/js/bootstrap-switch.min.js"></script>
 <link href="${pageContext.request.contextPath}/static/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css">
 <script>
     $(function(argument) {
      $('[type="checkbox"]').bootstrapSwitch({
    	  toggleRadioStateAllowUncheck: false,
    	  onText:"启动",  
	         offText:"停止",  
	         onColor:"success",  
	         offColor:"info",  
	         size:"small",  
	         onSwitchChange:function(event,state){  
	             if(state==true){  
	                 $(this).val("1");
	                 var url = "${pageContext.request.contextPath }/exam/stuExam";
	                 window.location.href = url;
	             }else{  
	                 $(this).val("2");  
	             }  
	         }  
      });
	    $('input[name="checkboxName"]').on('switchChange.bootstrapSwitch', function(event, state) {  
	 		 console.log(this); // DOM element  
	 		 console.log(event); // jQuery event  
	 		 console.log(state); // true | false  
		});  
    })  
    
/*     $('input[name="checkboxName"]').each(function() {
		  $(this).bootstrapSwitch({  
		         onText:"启动",  
		         offText:"停止",  
		         onColor:"success",  
		         offColor:"info",  
		         size:"small",  
		         onSwitchChange:function(event,state){  
		             if(state==true){  
		                 $(this).val("1");  
		             }else{  
		                 $(this).val("2");  
		             }  
		         }  
		     });  
	  }); */
</script>
</head>
<body>
	
	<label for="ready">准备好考试了吗？</label>
	<!-- <div class="bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-on bootstrap-switch-animate " style="width: 108px;" align="center">
		 <div class="bootstrap-switch-container" id="go" style="width: 109px; margin-left: 0px;">
			<span class="bootstrap-switch-handle-on bootstrap-switch-primary" style="width: 53px;">OFF</span><span class="bootstrap-switch-label" style="width: 53px;">&nbsp;</span>
			<span class="bootstrap-switch-handle-off bootstrap-switch-default" style="width: 53px;">ON</span>
				<input class="form-control" type="checkbox" checked="checked">
		</div> 
	</div> -->
	
	<div class="switch" data-animated="false">
   		<input name="checkboxName" type="checkbox" data-size="small"/>
	</div>
	
	
</body>
</html>